{% extends 'group_base.html' %}

{% block theme %}
{{ group.name }}
{% endblock %}

{% block topic_content %}
<div class="infobox">
	<div class="ex1">
		<span></span>
	</div>
	{% if current_page == 1 %}
	<div class="bd">
		<img align="left" valign="top" class="pil groupicon" src={{ group.logo }} alt={{ group.name }} />
		<p>
			创建于{{group.create_datetime|date:"Y-m-j"}}    
			<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
			组长： 
			<a href=""> {{group.administrators.all.0.name}} </a>
			&nbsp;
			{% if is_admin %}
			<a href="/group/update_group/{{group.id}}/" style="float: right;">更新小组信息</a>
			{% endif %}
			<br>
		</p>
		<p>
		{{ group.description|safe }}
		</p>
		<div style="margin-top: 10px" class="clearfix">
			{% if is_member %}
			<span class="fleft mr5 color-gray">
				<br>				
				{% if is_admin %}
				{% else %}
				我是这个小组的成员
				<a style="margin-left:6px;" href="/group/exit_group/{{group.id}}/" class="j a_confirm_link" title="退出小组">&gt;退出小组</a>
				{% endif %}
			</span>
			{% else %}
				{% if is_apply %}
					<span style="float: right;">已发送申请</span>
				{% else %}
				<span class="fright color-gray mr5">
					<a href="/group/join_group/{{group.id}}/" class="bn-std1">
						<span>加入小组</span>
					</a>
				</span>
				{% endif %}
			{% endif %}
		</div>
	</div>
	{% endif %}
	<div class="ex2">
		<span></span>
	</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
	$(".click_tip").click(function(){
		$(".blocktip").css("display", "block");
	});
	
	$(".disappear").click(function(){
		$(".blocktip").css("display", "none");
	});
});
</script>
<h2 style="margin-top: 10px; ">
	{% if is_member %}
	<a href="/group/new_topic/{{group.id}}/" class="rr bn-post" style="text-decoration:none">
		发言
	</a>
	{% else %}
	<span class="tipwrap rr">
		<a class="j click_tip bn-post" style="text-decoration:none">
			<span>发言</span>
		</a>
		<div class="blocktip group_say" >
			<div class="blocktip_content group_say_content">
				<div>先加入小组</div>
			</div>
			<input class="disappear" type="submit" value="知道了">
		</div>
	</span>
	{% endif %}
	最近小组话题 ······
</h2>					
{% endblock %}

{% block tbody %}
<tr>
	<td></td>
	<td>话题</td>
	<td>作者</td>
	<td nowrap="nowrap">回应</td>
	<td align="right">发布时间</td>
</tr>
{% for post in posts %}
<tr>
	<td>
		{% if post.stick %}
			<img src="/image/up.png" />
		{% else %}
			<img src="/image/none.png" />
		{% endif %}
		
		{% if post.elite %}
			<img src="/image/star.png">
		{% else %}
			<img src="/image/post.png">
		{% endif %}
	</td>
	<td>
		<a href="/group/post/{{ post.id }}/" title={{post.title}}>{{post.title}}</a>
	</td>
	<td nowrap="nowrap">
		<a href="">{{post.poster.name}}</a>
	</td>
	<td nowrap="nowrap">{{post.replied_count}}</td>
	<td nowrap="nowrap" class="time" align="right">{{post.post_datetime|date:"Y-m-j f"}}</td>
</tr>
{% endfor %} 
{% endblock %}

{% block aside %}

{% if is_admin %}
<h2><a href="/group/group_requests/{{group.id}}/" style="font-size: 14px;">**&nbsp;{{apply_number}}条新请求&nbsp;**</a></h2>
{% endif %}
<h2>
友情小组 ······
{% if is_admin %}
&nbsp;&nbsp;
<a href="/group/friend_groups/{{group.id}}/" style="font-size: 13px;">(更新)</a>
{% endif %}
</h2>
<div class="obss">
	{% for friend_group in friend_groups %}
	<dl class="ob">
		<dt>
			<a href="/group/gr/{{ friend_group.id }}/">
				<img src="{{ friend_group.logo }}" class="m_sub_img" alt={{ friend_group.name }} style="width: 70%";">
			</a>
		</dt>
		<dd>
			<a href="/group/gr/{{ friend_group.id }}/">{{ friend_group.name }}</a>
			<span>({{ friend_group.members.all|length }})</span>
		</dd>
	</dl>
	{% endfor %}
</div>
<div class="clear"></div>
<h2>最近加入 ······ </h2>
{% for membership in new_memberships %}
<dl class="obu">
	<dt>
		<a href="" class="nbg">
			{% if membership.member.image %}
			<img src="/{{ membership.member.image }}" class="m_sub_img" alt={{ membership.member.name }}>
			{% else %}
			<img src="/image/default_user.gif" class="m_sub_img" alt={{ membership.member.name }}>
			{% endif %}
		</a>
	</dt>
	<dd>
		<a href="">{{ membership.member.name }}</a>
		<br>
		<span class="pl">
		{% if membership.member.role_type == 'S' %}
			(学生)
		{% else %}
			(教师)
		{% endif %}
		</span>
	</dd>
</dl>
{% endfor %}

<br clear = "all">
<p class="pl2">
	&gt;
	<a href="/group/members/{{ group.id }}/">浏览所有成员 ({{group.members.all|length}})</a>
</p>

{% endblock %}

	
		